package com.oop10.PCI;

public class Computer {
	Cpu cpu;
	Memory memory;
	USB usb1;
	USB usb2;
	USB usb3;
	MainBoard mb = new MainBoard();
	PCI nc = new NetworkCard();
	PCI sc = new SoundCard();

	public Computer() {
		super();
	}

	public Computer(Cpu cpu, Memory memory, USB usb1, USB usb2, USB usb3) {
		super();
		this.cpu = cpu;
		this.memory = memory;
		this.usb1 = usb1;
		this.usb2 = usb2;
		this.usb3 = usb3;
	}

	public void computerStart() {
		cpu.start();
		memory.start();
		usb1.start();
		usb2.start();
		usb3.start();

	}

	public void computerWork() {
		mb.usePCICard(nc);
		mb.usePCICard(sc);

	}

	public void computerStop() {
		cpu.stop();
		memory.stop();
		usb1.stop();
		usb2.stop();
		usb3.stop();

	}

	public static void main(String[] args) {
		Cpu cpu1 = new Intel();
		Cpu cpu2 = new AMD();
		Memory memory1 = new Kingston();
		Memory memory2 = new HunyDai();
		USB usb1 = new Mouse();
		USB usb2 = new Keyboard();
		USB usb3 = new Fan();

		Computer computer1 = new Computer(cpu1, memory1, usb1, usb2, usb3);
		computer1.computerStart();
		computer1.computerWork();
		computer1.computerStop();
		System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
		Computer computer2 = new Computer(cpu2, memory2, usb1, usb2, usb3);
		computer2.computerStart();
		computer2.computerWork();
		computer2.computerStop();

	}

}
